/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.manage.core.repository.entity;

import com.gitee.peigenlpy.actable.annotation.Column;
import com.gitee.peigenlpy.actable.annotation.Index;
import com.gitee.peigenlpy.actable.annotation.Table;
import com.gitee.peigenlpy.actable.annotation.Unique;
import com.gitee.peigenlpy.actable.constants.MySqlCharsetConstant;
import com.gitee.peigenlpy.actable.constants.MySqlEngineConstant;
import com.gitee.peigenlpy.actable.constants.MySqlTypeConstant;
import com.gitee.peigenlpy.sansheng.core.annotation.ColumnField;
import info.peigen.hotpot.component.data.repository.beetlsql.entity.AbstractCreateTimeEntity;
import info.peigen.hotpot.manage.core.enums.UserStatus;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;

import java.util.Date;

/**
 * <b>(UserEntity)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2024/6/7
 */
@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
@Table(name = "user", comment = "用户", charset = MySqlCharsetConstant.UTF8MB4, engine = MySqlEngineConstant.InnoDB)
@org.beetl.sql.annotation.entity.Table(name = "user")
public class UserEntity extends AbstractCreateTimeEntity {
    @ColumnField(key = true)
    @Unique(value = "userId", columns = "user_id")
    @Column(name = "user_id", type = MySqlTypeConstant.VARCHAR, length = 30, isNull = false, comment = "用户Id")
    @org.beetl.sql.annotation.entity.Column("user_id")
    String     userId;
    @ColumnField(change = false, testUnique = "loginName", testValue = "peigen@peigen.info,18988881111")
    @Column(name = "login_name", type = MySqlTypeConstant.VARCHAR, length = 200, isNull = false, comment = "登录名")
    @Unique(value = "loginName", columns = "login_name")
    @org.beetl.sql.annotation.entity.Column("login_name")
    String     loginName;
    @ColumnField(change = false, changeShow = false, infoShow = false, testValue = "123123,321321")
    @Column(name = "password", type = MySqlTypeConstant.VARCHAR, length = 100, isNull = false, comment = "登录密码")
    @org.beetl.sql.annotation.entity.Column("password")
    String     password;
    @ColumnField(change = false, changeShow = false, infoShow = false, testValue = "123123,321321")
    @Column(type = MySqlTypeConstant.VARCHAR, length = 100, comment = "确认登录密码", ignore = true)
    String     confirmPassword;
    @ColumnField(create = false, infoShow = false, testValue = "123123,321321")
    @Column(type = MySqlTypeConstant.VARCHAR, length = 100, comment = "老登录密码", ignore = true)
    String     oldPassword;
    @ColumnField(create = false, infoShow = false, testValue = "111111,222222")
    @Column(type = MySqlTypeConstant.VARCHAR, length = 100, comment = "新登录密码", ignore = true)
    String     newPassword;
    @ColumnField(create = false, infoShow = false, testValue = "111111,222222")
    @Column(type = MySqlTypeConstant.VARCHAR, length = 100, comment = "确认新登录密码", ignore = true)
    String     confirmNewPassword;
    @ColumnField(create = false, change = false, changeShow = false, infoShow = false)
    @Column(name = "salt", type = MySqlTypeConstant.VARCHAR, length = 20, isNull = false, comment = "密码盐")
    @org.beetl.sql.annotation.entity.Column("salt")
    String     salt;
    @ColumnField(create = false, changeShow = false)
    @Column(name = "status", type = MySqlTypeConstant.VARCHAR, length = 20, isNull = false, comment = "状态")
    @Index(value = "status", columns = "status")
    @org.beetl.sql.annotation.entity.Column("status")
    UserStatus status;
    @ColumnField(create = false, change = false, changeShow = false)
    @Column(name = "mobile", type = MySqlTypeConstant.VARCHAR, length = 20, comment = "用户手机号")
    @org.beetl.sql.annotation.entity.Column("mobile")
    String     mobile;
    @ColumnField(create = false, change = false, changeShow = false)
    @Column(name = "email", type = MySqlTypeConstant.VARCHAR, length = 100, comment = "用户邮箱")
    @org.beetl.sql.annotation.entity.Column("email")
    String     email;
    @ColumnField(create = false, changeShow = false, foreignKey = "Role")
    @Column(name = "role_ids", type = MySqlTypeConstant.VARCHAR, length = 1000, comment = "角色Ids")
    @org.beetl.sql.annotation.entity.Column("role_ids")
    String     roleIds;
    @ColumnField(create = false, changeShow = false, foreignKey = "Position")
    @Column(name = "position_ids", type = MySqlTypeConstant.VARCHAR, length = 1000, comment = "职位Ids")
    @org.beetl.sql.annotation.entity.Column("position_ids")
    String     positionIds;
    @ColumnField(create = false, changeShow = false, foreignKey = "Organization")
    @Column(name = "organization_ids", type = MySqlTypeConstant.VARCHAR, length = 1000, comment = "组织Ids")
    @org.beetl.sql.annotation.entity.Column("organization_ids")
    String     organizationIds;
    @ColumnField(create = false, change = false, changeShow = false)
    @Column(name = "login_last_fail_time", type = MySqlTypeConstant.TIMESTAMP, comment = "最后登录失败时间")
    @org.beetl.sql.annotation.entity.Column("login_last_fail_time")
    Date       loginLastFailTime;
    @ColumnField(create = false, change = false, changeShow = false)
    @Column(name = "login_password_error_times", type = MySqlTypeConstant.INT, comment = "登录密码错误次数")
    @org.beetl.sql.annotation.entity.Column("login_password_error_times")
    Integer    loginPasswordErrorTimes;
    @ColumnField(create = false, change = false, changeShow = false)
    @Column(name = "login_password_valid_time", type = MySqlTypeConstant.TIMESTAMP, comment = "登录密码失效时间")
    @org.beetl.sql.annotation.entity.Column("login_password_valid_time")
    Date       loginPasswordValidTime;
    @ColumnField(create = false, change = false, changeShow = false)
    @Column(name = "login_password_last_modify_time", type = MySqlTypeConstant.TIMESTAMP, comment = "最后一次登录密码修改时间")
    @org.beetl.sql.annotation.entity.Column("login_password_last_modify_time")
    Date       loginPasswordLastModifyTime;
    @ColumnField(create = false, change = false, changeShow = false)
    @Column(name = "last_login_time", type = MySqlTypeConstant.TIMESTAMP, comment = "最后一次登录时间")
    @org.beetl.sql.annotation.entity.Column("last_login_time")
    Date       lastLoginTime;
    @ColumnField(create = false, change = false, changeShow = false)
    @Column(name = "last_login_ip", type = MySqlTypeConstant.VARCHAR, length = 20, comment = "最后登录IP")
    @org.beetl.sql.annotation.entity.Column("last_login_ip")
    String     lastLoginIp;
    @ColumnField(testValue = "测试数据")
    @Column(name = "memo", type = MySqlTypeConstant.VARCHAR, length = 2000, comment = "memo")
    @org.beetl.sql.annotation.entity.Column("memo")
    String     memo;
}